package com.smh.demo1.a07;

import com.smh.demo1.common.LogColour;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.DisposableBean;

import javax.annotation.PreDestroy;

/**
 * @author shiminghui
 * @date 2025/4/12 11:04
 * @description: TODO
 */
public class Bean2 implements DisposableBean {

    private static final Logger log = LoggerFactory.getLogger(Bean2.class);

    @Override
    public void destroy() throws Exception {
        log.info(LogColour.Blue("Bean2 DisposableBean Aware接口的回调"));
    }

    @PreDestroy
    public void preDestroy() {
        log.info(LogColour.Blue("Bean2 preDestroy"));
    }

    public void destroy2() {
        log.info(LogColour.Blue("Bean2 destroy @Bean方法回调"));
    }
}
